Skip to content


ai  101  pytorch  classification  nvidia  cuda  install  tensorrt  yolo  ardupilot  None  ros2  dds  micro ros  xrce  sitl  plugin  SITL  debug  rangefinder  pymavlink  mavros  gazebo  distance sensor  system_time  timesync  cmake  gtest  ctest  cpp  c++  format  fmt  multithreading  spdlog  camera  coordinate system  orb  matching  opencv  build  transformation  computer vision  homography  optical flow  of  trackers  cv  cyclonedds  eprosima  fastdds  simulation  config  ignition  bridge  sdf  tips  ign-transport  sensors  lidar  aptly  apt  encryption  pgp  docker  git  bundle  github  hooks  pre-commit  lxd  container  lxc  x11  profile  vscode  marpit  presentation  marp  markdown  mermaid  video  ffmpeg  gstreamer  cheat-sheet  sdp  v4l2loopback  gi  snippets  cheat Sheet  python  asyncio  future  click  cli  numpy  project  template  black  isort  docs  project document  docstrings  flake8  linter  git-hook  mypy  unittest  pytest  pylint  mock  iterator  generator  logging  tuple  namedtuple  typing  annotation  pyzmq  zmq  msgpack  action  namespace  remap  control2  ros2_control  gdb  qos  tag  plugins  msg  node  zero-copy  shm  tutorial  algorithm  calibration  diff  pid  dev  colcon  colcon_cd  rpi  arm  qemu  settings  behavior  plot  visualization  debugging  diagnostic  diagnostics  tutorials  gst  math  apm  rat_runtime_monitor  web  rosbridge  vue  binding  discovery  gazebo-classic  launch  spawn  cook  gps  imu  ray  gazebo_ros_ray_sensor  ultrsonic  range  ultrasonic  gazebo classic  wrench  effort  odom  ign  gz  xacro  ros_ign  diff_drive  odometry  joint_state  argument  OpaqueFunction  DeclareLaunchArgument  LaunchConfiguration  tmux  nav  slam  test  rclpy  executor  MultiThreadedExecutor  SingleThreadedExecutor  param  dynamic-reconfigure  service  client  setup.py  package.xml  parameter  parameters  custom  msgs  executers  pub  sub  rqt  rviz  rviz2  pose  marker  tf2  deb  package  setup  local_setup  rosdep  package manager  project settings  vcstool  cross-compiler  nano  texture  tmuxp  rootfs  embedded  zah  linux  rm  ubuntu  ip  ss  network  netstat  snap  deploy  ssh  systemd  mkdocs  extensions  socat  networking  serial  udp  tc  mtu  select  px4  robotics  kalman_filter  kalman  filter  control  todo  vscode-ext  json  yaml  schema  yocto  poky  world  gazebo_ros2_control  position_controller  effort_controller  velocity_controller  urdf  gazebo_ros_force  gazebo_ros_joint_state_publisher  robot_state_publisher  joint_state_publisher  projects  vrx  buoyancy 

ROS2 domain_id and DDS ports


Table of Content

udp shm

The last releases of Fast-DDS come with SharedMemory transport by default

udp#

  • Using custom profile to disabled SHM
fastrtps-profile.xml
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>CustomUdpTransport</transport_id>
            <type>UDPv4</type>
        </transport_descriptor>
    </transport_descriptors>

    <participant profile_name="participant_profile" is_default_profile="true">
        <rtps>
            <userTransports>
                <transport_id>CustomUdpTransport</transport_id>
            </userTransports>

            <useBuiltinTransports>false</useBuiltinTransports>
        </rtps>
    </participant>
</profiles>

usage#

export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/fastrtps-profile.xml

domain_id port calc

7400 + (250 * Domain)

Udp demo#

  • domin_id 0

Domain ID to UDP Port Calculator

terminal1
export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/fastrtps-profile.xml
ros2 run demo_nodes_cpp talker
terminal2
export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/fastrtps-profile.xml
ros2 run demo_nodes_cpp listener
ss output
ss -lup
#
0.0.0.0:45800                                   0.0.0.0:*                   users:(("listener",pid=945597,fd=11))               
192.168.1.221:54487                                   0.0.0.0:*                   users:(("python3",pid=848435,fd=15))                
0.0.0.0:mdns                                    0.0.0.0:*                                                                       
0.0.0.0:39489                                   0.0.0.0:*                   users:(("python3",pid=848435,fd=14))                
192.168.1.221:39981                                   0.0.0.0:*                   users:(("listener",pid=945597,fd=12))               
0.0.0.0:7400                                    0.0.0.0:*                   users:(("listener",pid=945597,fd=8))                
0.0.0.0:7400                                    0.0.0.0:*                   users:(("talker",pid=945585,fd=8))                  
0.0.0.0:7400                                    0.0.0.0:*                   users:(("python3",pid=848435,fd=9))                 
0.0.0.0:7412                                    0.0.0.0:*                   users:(("talker",pid=945585,fd=9))                  
0.0.0.0:7413                                    0.0.0.0:*                   users:(("talker",pid=945585,fd=10))                 
0.0.0.0:7414                                    0.0.0.0:*                   users:(("listener",pid=945597,fd=9))                
0.0.0.0:7415                                    0.0.0.0:*                   users:(("listener",pid=945597,fd=10))               
0.0.0.0:7418                                    0.0.0.0:*                   users:(("python3",pid=848435,fd=10))                
0.0.0.0:7419                                    0.0.0.0:*                   users:(("python3",pid=848435,fd=12))                
127.0.0.53%lo:domain                                  0.0.0.0:*                                                                       
192.168.1.221:32836                                   0.0.0.0:*                   users:(("talker",pid=945585,fd=12))                 
0.0.0.0:631                                     0.0.0.0:*                                                                       
0.0.0.0:58699                                   0.0.0.0:*                   users:(("talker",pid=945585,fd=11))  

All applications:

DiscoveryMulticastPort = 7400 UserMulticastPort = 7401

First application:

DiscoveryUnicastPort = 7410 UserUnicastPort = 7411

Second application:

DiscoveryUnicastPort = 7412 UserUnicastPort = 7413


Reference#